package com.ruoyi.tcm.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.tcm.mapper.TcmAnnouncementMapper;
import com.ruoyi.tcm.domain.TcmAnnouncement;
import com.ruoyi.tcm.service.ITcmAnnouncementService;

/**
 * 公告Service业务层处理
 * 
 * @author cong
 * @date 2025-02-07
 */
@Service
public class TcmAnnouncementServiceImpl implements ITcmAnnouncementService 
{
    @Autowired
    private TcmAnnouncementMapper tcmAnnouncementMapper;

    /**
     * 查询公告
     * 
     * @param id 公告主键
     * @return 公告
     */
    @Override
    public TcmAnnouncement selectTcmAnnouncementById(Long id)
    {
        return tcmAnnouncementMapper.selectTcmAnnouncementById(id);
    }

    /**
     * 查询公告列表
     * 
     * @param tcmAnnouncement 公告
     * @return 公告
     */
    @Override
    public List<TcmAnnouncement> selectTcmAnnouncementList(TcmAnnouncement tcmAnnouncement)
    {
        return tcmAnnouncementMapper.selectTcmAnnouncementList(tcmAnnouncement);
    }

    /**
     * 新增公告
     * 
     * @param tcmAnnouncement 公告
     * @return 结果
     */
    @Override
    public int insertTcmAnnouncement(TcmAnnouncement tcmAnnouncement)
    {
        tcmAnnouncement.setCreateTime(DateUtils.getNowDate());
        return tcmAnnouncementMapper.insertTcmAnnouncement(tcmAnnouncement);
    }

    /**
     * 修改公告
     * 
     * @param tcmAnnouncement 公告
     * @return 结果
     */
    @Override
    public int updateTcmAnnouncement(TcmAnnouncement tcmAnnouncement)
    {
        tcmAnnouncement.setUpdateTime(DateUtils.getNowDate());
        return tcmAnnouncementMapper.updateTcmAnnouncement(tcmAnnouncement);
    }

    /**
     * 批量删除公告
     * 
     * @param ids 需要删除的公告主键
     * @return 结果
     */
    @Override
    public int deleteTcmAnnouncementByIds(Long[] ids)
    {
        return tcmAnnouncementMapper.deleteTcmAnnouncementByIds(ids);
    }

    /**
     * 删除公告信息
     * 
     * @param id 公告主键
     * @return 结果
     */
    @Override
    public int deleteTcmAnnouncementById(Long id)
    {
        return tcmAnnouncementMapper.deleteTcmAnnouncementById(id);
    }
}
